package com.xbongbong.saas.service.impl;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.customerfocus.pojo.dto.CustomerFocusDeleteBatchDTO;
import com.xbongbong.pro.customerfocus.pojo.vo.CustomerFocusDeleteBatchVO;
import com.xbongbong.pro.enums.errorcodes.SystemErrorCodeEnum;
import com.xbongbong.saas.model.CustomerFocusModel;
import com.xbongbong.saas.service.CustomerFocusService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 客户关注
 * @author 吴峰
 * @version v1.0
 * @date 2019/3/14 15:06
 * @since v1.0
 */
@Service("customerFocusService")
public class CustomerFocusServiceImpl implements CustomerFocusService {

    private static final Logger LOG = LoggerFactory.getLogger(CustomerFocusServiceImpl.class);

    @Resource
    private CustomerFocusModel customerFocusModel;

    @Override
    public CustomerFocusDeleteBatchVO deleteBatch(CustomerFocusDeleteBatchDTO customerFocusDeleteBatchDTO) throws XbbException {
        CustomerFocusDeleteBatchVO customerFocusDeleteBatchVO = new CustomerFocusDeleteBatchVO();
        try {
            List<Long> idIn = customerFocusDeleteBatchDTO.getIdIn();
            String corpid = customerFocusDeleteBatchDTO.getCorpid();
            customerFocusModel.deleteBatch(idIn, corpid);
        } catch (Exception e) {
            LOG.error("CustomerFocusServiceImpl.deleteBatch 执行出错：", e);
            throw new XbbException(SystemErrorCodeEnum.API_ERROR_100001, SystemErrorCodeEnum.API_ERROR_100001.getMsg());
        }
        return customerFocusDeleteBatchVO;
    }
}
